#include "mat_pq.h"
#include "utils.h"
#include <iostream>
#include <cassert>
using namespace std;

double& getPQ(mat& a, int p, int q, int i, int j) {
	assert(i>=0 && i<a.size() && j>=i-p && j<=i+q);
	return a[i][j-i+p];
}

mat newMat(int n, int p, int q) {
	return mat(n, vector<double>(p+q+2));
}

void showPQ(mat& a, int p, int q) {
	int n=a.size();
	forn(i,n) {
		forn(j,n) {
			cout.precision(4);
			if(i>=0 && i<a.size() && j>=i-p && j<=i+q)
				cout << getPQ(a,p,q,i,j) << "\t";
			else cout << 0.0 << "\t";
		}
		cout << "|" << a[i][p+q+1] << endl;
	}
}
